<template>
	<div class="home">
		<div class="main">
			<!-- <p>
				调试环境：&nbsp;&nbsp;&nbsp;
				<a :href="url1">水电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url2">主变应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url3">风电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url4">光伏应用</a>
			</p>
			
			<p>
				线上环境：&nbsp;&nbsp;&nbsp;
				<a :href="url11">水电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url22">主变应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url33">风电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url44">光伏应用</a>
			</p>
			
			<p>
				生产环境：&nbsp;&nbsp;&nbsp;
				<a :href="url111">水电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url222">主变应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url333">风电应用</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url444">光伏应用</a>
			</p>
			
			<p>
				<a :href="url5">测试PaaS应用（测试环境地址）</a>
				&nbsp;&nbsp;&nbsp;
				<a :href="url6">测试PaaS应用（生产环境地址）</a>
			</p> -->
			<iframe ref="refIframeHome" :src="frameSrc" frameborder="0" width="100%" height="100%"></iframe>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				frameSrc: '',
				url1: '',
				url11: '',
				url111: '',
				url2: '',
				url22: '',
				url222: '',
				url3: '',
				url33: '',
				url333: '',
				url4: '',
				url44: '',
				url444: '',
				url5: '',
				url6: ''
			}
		},
		created() {
			let uid = sessionStorage.getItem('uid');
			let eiipToken = sessionStorage.getItem('eiip-token');
			let ssoToken = sessionStorage.getItem('sso-token');
			let paasToken = sessionStorage.getItem('paas-token')
			this.frameSrc = `${API.CMS_URL}?eiipToken=${eiipToken}&ssoToken=${ssoToken}&paasToken=${paasToken}`
			
			this.url1 = `http://192.168.200.125:8788?ssoToken=${ssoToken}&uid=${uid}`  //水电应用
			this.url2 = `http://192.168.200.125:8789?ssoToken=${ssoToken}&uid=${uid}`  //主变应用
			this.url3 = `http://192.168.200.125:8790?ssoToken=${ssoToken}&uid=${uid}`  //风电应用
			this.url4 = `http://192.168.200.125:8791?ssoToken=${ssoToken}&uid=${uid}`  //光伏应用
			
			this.url11 = `http://172.16.15.175:213?ssoToken=${ssoToken}&uid=${uid}`  //水电应用
			this.url22 = `http://172.16.15.175:212?ssoToken=${ssoToken}&uid=${uid}`  //主变应用
			this.url33 = `http://172.16.15.175:214?ssoToken=${ssoToken}&uid=${uid}`  //风电应用
			this.url44 = `http://172.16.15.175:211?ssoToken=${ssoToken}&uid=${uid}`  //光伏应用
			
			this.url111 = `http://10.11.0.34:8031?ssoToken=${ssoToken}&uid=${uid}`  //水电应用
			this.url222 = `http://10.11.0.34:8030?ssoToken=${ssoToken}&uid=${uid}`  //主变应用
			this.url333 = `http://10.11.0.34:8034?ssoToken=${ssoToken}&uid=${uid}`  //风电应用
			this.url444 = `http://10.11.0.34:8033?ssoToken=${ssoToken}&uid=${uid}`  //光伏应用
			
			this.url5 = `http://172.16.15.180/`
			this.url6 = `http://10.11.0.34/#/choose_new?token=${paasToken}`
		},
		methods: {
			iframeLoad() {
				console.log('home 页 加载完成');
				let iframe = this.$refs.refIframeHome;
				let iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
				let paasToken = sessionStorage.getItem('paas-token')
				iframeWin.postMessage(paasToken, '*');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home {
		height: calc(100vh - 80px);
		background: #f8f8f8;
			
		.main {
			height: 100%;
			background-color: white;
			overflow-y: hidden;
			box-sizing: border-box;
			position: relative;
		}
	}
</style>
